package com.easyapi.server.job;

import com.easyapi.common.annotation.JobLogging;
import com.easyapi.server.service.api.DataSourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * @author: javadadi
 * @Time: 21:29
 * @ClassName: DatasourceJob
 */
@Component
@Order(1)
public class DatasourceJob {
    @Resource
    private DataSourceService dataSourceService;

    @JobLogging
    @Scheduled(cron = "0 22 12 * * *")
    @PostConstruct
    public void init() {
        dataSourceService.initDruidDatasource();
    }
}
